package main

import (
	"github.com/yeahyf/go_base/cfg"
	"github.com/yeahyf/go_base/ver"
	"jian-picture-service/model"
	"jian-picture-service/server"
	"os"
	"os/signal"
	"syscall"
)

func init() {
	cfg.LoadCfg()
	model.Init()
}

func main() {
	notify := make(chan os.Signal, 1)
	signal.Notify(notify, os.Interrupt, syscall.SIGTERM, syscall.SIGKILL)
	go func() {
		<-notify
		os.Exit(0)
	}()

	v := ver.Version{
		SystemName: "picture server v1",
		VerNo:      "0.0.1",
		BuildTime:  "2024-07-17 11:59:00",
	}

	v.Print()
	v.Debug()
	port := cfg.GetInt("server.port")
	server.Start(port)
}
